package com.liyunlong.demoliyunlong.shangji;

// 适配器，将不同国家的电压适配为国内220V电压
public class VoltageAdapter implements get220Voltage {

    private ForeignV foreignV;

    public VoltageAdapter(ForeignV foreignV) {
        this.foreignV = foreignV;
    }

    @Override
    public int get220V() {
//  return 220;
        if (foreignV.getForeignVoltage() != 220) {
            foreignV = new ForeignV(220);
        }
        return foreignV.getForeignVoltage();
    }
}